﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Providers;
using RoomService.Service;
using RoomSvc.Data;
using System.Data.SqlClient;
using System.Text;
using System.Data;

namespace RoomService.Account
{
	public partial class Register : System.Web.UI.Page
	{
        protected void Page_Init(Object sender, EventArgs e)
        {


            btnTest.Click += new EventHandler(this.btnTest_Click);


        }

		protected void Page_Load(object sender, EventArgs e)
		{
		}

        protected void btnTest_Click(Object sender, EventArgs e)
        {

     
            if (email.Text == conf_email.Text && password.Text == conf_pass.Text)
            {
                Person p = new Person();
                p.first_name = fname.Text;
                p.last_name = lname.Text;
                p.email = email.Text;
                p.date_create = DateTime.Now;
                p.Pers_Type = ServiceClient.GetPersType("1");
                p.phone = phone.Text;
                p.date_birth = Convert.ToDateTime(bday.Text);
                p.password = password.Text;
                p.username = username.Text;
                PostResponse pr = ServiceClient.PostPerson(p);
                Response.Redirect("../Default.aspx");
            }
        }
	}
}